<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>   
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>我的收藏</title>
<link type="text/css" href="${staticResources}/css/personalcenter.css" rel="stylesheet" />
<script type="text/javascript" src="${staticResources}/js/ajax.js"></script>

<script type="text/javascript">
function deletefromfavorite(fid)
{
	var mode = "ajax";
	var params="fid=" + encodeURIComponent(fid);
	params+="&mode="+encodeURIComponent(mode);
	
	doAjax("DeleteFromFavorite"
			,params,function(rst){
	var rst=eval('(' +rst+ ')');
	if(rst.status == 0)
	{
		window.alert("成功移出收藏夹！");
	}
	else 
	{
		window.alert(rst.message);
	} 
	});
}
</script>
</head>
<body onload="iframeResizePipe()">

<iframe id="helpframe" src='' height='0' width='0' frameborder='0'></iframe>
<script type="text/javascript">
  function iframeResizePipe()
  {
     // What's the page height?
     var height = document.body.scrollHeight;

     // Going to 'pipe' the data to the parent through the helpframe..
     var pipe = document.getElementById('helpframe');

     // Cachebuster a precaution here to stop browser caching interfering
     pipe.src = '${contextPath}/framehelper.html?height='+height+'&cacheb='+Math.random();
  }
</script>

<div class="con">
  <div class="scj">
    <div class="grey2" style="font-weight:600">我的收藏</div>
    
    <c:forEach var = "favorite" items = "${page.records}">
    <c:set var="bookitem" value="${favorite.book }" />
    <div class="lists">
      <div class="lists">
        <div class="list">
          <img src="${staticResources}/image/listbook_11.gif" width="73" height="86" alt="">
          <a href="#">书名：${fn:escapeXml(bookitem.name)}</a><big>价格：</big><b>￥${bookitem.price }</b><br>
          <small>新旧程度：${bookitem.condition }</small>&nbsp;<small>笔记：${bookitem.hasNote }</small>	 
        </div>
        <div>
          <div class="shopper">
            <small>卖家：</small><small><a href="#">${fn:escapeXml(bookitem.owner.nickName)}</a></small><br>
            <small>信誉度：${bookitem.owner.creditPoint}</small>
          </div>
          <div class="botton">
            <a href="#"><img src="${staticResources}/image/personalcenter4_11.gif" width="102" height="30" alt=""></a>
            <a href="javascipt:void(0)" onclick = "deletefromfavorite(${favorite.FID});return false;"><img src="${staticResources}/image/personalcenter4_12.gif" width="101" height="30" alt=""></a>
          </div>
        </div> 
      </div>
    </div>
    </c:forEach>
    
  </div>

  <div id="page">
    <ul>  
    
      <c:choose>
      <c:when test = "${page.hasPrevious}">
        <li><a href="?curPage=1&pageSize=${page.pageSize}">首页</a></li>
        <li><a  href="?keyword=$curPage=${page.prePage}&pageSize=${page.pageSize}">上一页</a></li>
      </c:when>
      <c:otherwise>
        <li class = "currentpage">已到首页</li>
      </c:otherwise>
      </c:choose>
      <c:if test="${page.currentPage-3 gt 0}">
        <li><a href = "?curPage=${page.currentPage-3}&pageSize=${page.pageSize}">${page.currentPage-3}</a></li>
      </c:if>
      <c:if test="${page.currentPage-2 gt 0}">
        <li><a href = "?curPage=${page.currentPage-2}&pageSize=${page.pageSize}">${page.currentPage-2}</a></li>
      </c:if>
      <c:if test="${page.currentPage-1 gt 0}">
        <li><a href = "?curPage=${page.currentPage-1}&pageSize=${page.pageSize}">${page.currentPage-1}</a></li>
      </c:if>
      
      <li class = "currentpage"><b>${page.currentPage}</b></li>
  
      <c:if test="${page.maxPage - page.currentPage -0 gt 0}">
        <li><a href = "?curPage=${page.currentPage+1}&pageSize=${page.pageSize}">${page.currentPage+1}</a></li>
      </c:if>
      <c:if test="${page.maxPage - page.currentPage -1 gt 0}">
        <li><a href = "?curPage=${page.currentPage+2}&pageSize=${page.pageSize}">${page.currentPage+2}</a></li>
      </c:if>
      <c:if test="${page.maxPage - page.currentPage -2 gt 0}">
        <li><a href = "?curPage=${page.currentPage+3}&pageSize=${page.pageSize}">${page.currentPage+3}</a></li>
      </c:if>
      <c:choose>
      <c:when test = "${page.hasNext}">
        <li><a href="?curPage=${page.nextPage}&pageSize=${page.pageSize}">下一页</a></li>
        <li><a href="?curPage=${page.maxPage}&pageSize=${page.pageSize}">末页</a></li>
      </c:when>
      <c:otherwise>
        <li class = "currentpage">已到末页</li>
      </c:otherwise>
      </c:choose>
    
    </ul>
  </div> 

</div>

</body>
</html>